package main

import (
	"chat/models"
	// "fmt"

	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func main() {
	db, err := gorm.Open(mysql.Open("root:123456@tcp(127.0.0.1:3306)/chat?charset=utf8mb4&parseTime=True"), &gorm.Config{})
	if err != nil {
		panic("failed to connect  database")
	}
	db.AutoMigrate(models.UserBasic{})
	db.AutoMigrate(models.Message{})
	db.AutoMigrate(models.Contact{})
	db.AutoMigrate(models.GroupBasic{})
	db.AutoMigrate(models.RoomBasic{})
	db.AutoMigrate(models.RoomUser{})
	db.AutoMigrate(models.Notice{})

}
